package com.hippoframework.utils;
import java.util.function.Supplier;

/**
 * @author YichuanWang
 * @date 12/27/2019 5:06 PM
 */
public class Assert extends cn.hutool.core.lang.Assert {

    public static void isTrue(boolean expression, Supplier<String> messageSupplier) {
        if (!expression) {
            throw new IllegalArgumentException(nullSafeGet(messageSupplier));
        }
    }

    private static String nullSafeGet(Supplier<String> messageSupplier) {
        return (messageSupplier != null ? messageSupplier.get() : null);
    }
}
